#include <iostream>

using std::cout;
using std::endl;

void insertion_sort(int a[],int len) {
	int key = 0;
	
	for(int i=1;i<len;i++) {
		key = a[i];
		int j = i-1;
		while(j>=0 && a[j]>key) {
			a[j+1] = a[j];
			j = j-1;
		}
		a[j+1] = key;
	}
}

int main() {
	int a[] = {5,2,4,6,1,3};
	insertion_sort(a,6);
	for(int i=0;i<6;i++) {
		cout << a[i] << " ";
	}
	cout << endl;
	return 0;
}